package com.epfresh.bean;

import java.util.List;

/**
 * Created by wzh on 16-7-14.
 */
public class CartGoods {
    public boolean isShowOfferBtn() {
        return showOfferBtn;
    }

    public void setShowOfferBtn(boolean showOfferBtn) {
        this.showOfferBtn = showOfferBtn;
    }

    private String groupKey;
    private String deliveryMinAmount;

    private boolean showOfferBtn;
    private boolean isExpend;
    //isDisabled == 1表示失效商品
    private int isDisabled;
    private String wholeSaleMarketName;

    private String storeOrMarketName;
    private String wholeSaleMarketFullName;
    private String wholeSaleMarketId;
    private String distributionId;
    private String distributionTitle;
    private String distributionExpressFee;
    private float feed;
    private List<CartGood> result;
    private List<DeliveryModes> deliveryList;
    private List<PaymentModes> payTypeList;
    private List<Dc> distributionList;
    private List<DeliveryDate> deliveryDateList;

    private DeliveryDate deliveryDateDef;

    private boolean isSelect = true;

    private boolean isDeliverySelect = true;

    private boolean isPaymentFirst = true;
    //商品类型,1,整货,2,散货
    private int wholeSalesType = 1;

    public int getWholeSalesType() {
        return wholeSalesType;
    }

    public void setWholeSalesType(int wholeSalesType) {
        this.wholeSalesType = wholeSalesType;
    }

    public String getWholeSaleMarketId() {
        return wholeSaleMarketId;
    }

    public void setWholeSaleMarketId(String wholeSaleMarketId) {
        this.wholeSaleMarketId = wholeSaleMarketId;
    }

    public boolean isDeliverySelect() {
        return isDeliverySelect;
    }

    public void setDeliverySelect(boolean deliverySelect) {
        isDeliverySelect = deliverySelect;
    }

    public String getWholeSaleMarketName() {

        if ((wholeSaleMarketName == null || "".equals(wholeSaleMarketName)
                || "null".equals(wholeSaleMarketName)) && wholeSaleMarketFullName != null && !"".equals(wholeSaleMarketFullName)) {
            return wholeSaleMarketFullName;
        }
        return wholeSaleMarketName == null ? "" : wholeSaleMarketName;
    }

    public void setWholeSaleMarketName(String wholeSaleMarketName) {
        this.wholeSaleMarketName = wholeSaleMarketName;
    }

    public String getStoreOrMarketName() {
        return storeOrMarketName;
    }

    public void setStoreOrMarketName(String storeOrMarketName) {
        this.storeOrMarketName = storeOrMarketName;
    }

    public List<CartGood> getResult() {
        return result;
    }

    public void setResult(List<CartGood> goods) {
        this.result = goods;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }


    public boolean isDisabled() {
        return isDisabled == 1 ? true : false;
    }

    public void setIsDisabled(int isDisabled) {
        this.isDisabled = isDisabled;
    }


    public int getIsDisabled() {
        return isDisabled;
    }

    public String getWholeSaleMarketFullName() {
        if ((wholeSaleMarketFullName == null || "".equals(wholeSaleMarketFullName) || "null".equals(wholeSaleMarketFullName)) && wholeSaleMarketName != null && !"".equals(wholeSaleMarketName)) {
            return wholeSaleMarketName;
        }
        return wholeSaleMarketFullName == null ? "" : wholeSaleMarketFullName;
    }

    public void setWholeSaleMarketFullName(String wholeSaleMarketFullName) {
        this.wholeSaleMarketFullName = wholeSaleMarketFullName;
    }

    public String getDistributionId() {
        return distributionId;
    }

    public void setDistributionId(String distributionId) {
        this.distributionId = distributionId;
    }

    public String getDistributionTitle() {
        return (distributionTitle==null || "".equals(distributionTitle))?getWholeSaleMarketName():distributionTitle;
    }

    public void setDistributionTitle(String distributionTitle) {
        this.distributionTitle = distributionTitle;
    }

    public String getDistributionExpressFee() {
        return distributionExpressFee;
    }

    public void setDistributionExpressFee(String distributionExpressFee) {
        this.distributionExpressFee = distributionExpressFee;
    }

    public float getFeed() {
        return feed;
    }

    public void setFeed(float feed) {
        this.feed = feed;
    }

    public List<PaymentModes> getPayTypeList() {
        return payTypeList;
    }

    public void setPayTypeList(List<PaymentModes> payTypeList) {
        this.payTypeList = payTypeList;
    }

    public List<DeliveryModes> getDeliveryList() {
        return deliveryList;
    }

    public void setDeliveryList(List<DeliveryModes> deliveryList) {
        this.deliveryList = deliveryList;
    }

    public List<Dc> getDistributionList() {
        return distributionList;
    }

    public void setDistributionList(List<Dc> distributionList) {
        this.distributionList = distributionList;
    }

    public boolean isPaymentFirst() {
        return isPaymentFirst;
    }

    public void setPaymentFirst(boolean paymentFirst) {
        isPaymentFirst = paymentFirst;
    }

    public String getDeliveryMode() {

        if (isDeliverySelect) {

            if (deliveryList != null) {
                for (int i = 0; i < deliveryList.size(); i++) {
                    DeliveryModes deliveryModes = deliveryList.get(i);
                    String code = deliveryModes.getCode();

                    if ("gatherDistribution".equals(code)) {//集单配送
                        return "gatherDistribution";
                    } else if ("selfDelivery".equals(code)) {

                    }
                }
            }
        }
        return "selfDelivery";
    }

    public DeliveryDate getDefDeliveryDate(){
        if (deliveryDateList != null && deliveryDateList.size() >0){
            return deliveryDateList.get(0);
        }
        return null;
    }


    public List<DeliveryDate> getDeliveryDateList() {
        return deliveryDateList;
    }

    public void setDeliveryDateList(List<DeliveryDate> deliveryDateList) {
        this.deliveryDateList = deliveryDateList;
    }

    public DeliveryDate getDeliveryDateDef() {
        return deliveryDateDef;
    }

    public void setDeliveryDateDef(DeliveryDate deliveryDateDef) {
        this.deliveryDateDef = deliveryDateDef;
    }

    public boolean isExpend() {
        return isExpend;
    }

    public void setExpend(boolean expend) {
        isExpend = expend;
    }

    public String getGroupKey() {
        return groupKey;
    }

    public void setGroupKey(String groupKey) {
        this.groupKey = groupKey;
    }

    public String getDeliveryMinAmount() {
        return deliveryMinAmount;
    }

    public void setDeliveryMinAmount(String deliveryMinAmount) {
        this.deliveryMinAmount = deliveryMinAmount;
    }

    @Override
    public String toString() {
        return "CartGoods{" +
                "isDisabled=" + isDisabled +
                ", wholeSaleMarketName='" + wholeSaleMarketName + '\'' +
                ", wholeSaleMarketFullName='" + wholeSaleMarketFullName + '\'' +
                ", wholeSaleMarketId='" + wholeSaleMarketId + '\'' +
                ", distributionId='" + distributionId + '\'' +
                ", distributionTitle='" + distributionTitle + '\'' +
                ", distributionExpressFee='" + distributionExpressFee + '\'' +
                ", result=" + result +
                ", deliveryList=" + deliveryList +
                ", isSelect=" + isSelect +
                ", isDeliverySelect=" + isDeliverySelect +
                '}';
    }


}
